
public class Caja {
	
	private static int contCajas = 0;
	private final int contMax = 10;
	private String color;
	private double ancho, alto, largo, volumen;
	private int numCosas;
	
	public Caja (String col) {
		this.color = col;
		this.ancho = 1;
		this.alto = 1;
		this.largo = 1;
		this.numCosas = 0;
		this.anadirCaja();
	}
	
	public Caja (String col, double anch, double alt, double larg) {
		this.color = col;
		this.ancho = anch;
		this.alto = alt;
		this.largo = larg;
		this.numCosas = 0;
		this.anadirCaja();
	}
	
	public String getColor () {
		return this.color;
	}
	
	public double getAncho () {
		return this.ancho;
	}
	
	public double getAlto () {
		return this.alto;
	}
	
	public double getLargo () {
		return this.largo;
	}
	
	public int getNumCosas () {
		return this.numCosas;
	}
	
	public void setColor (String col) {
		this.color = col;
	}
	
	private static void anadirCaja (){
		contCajas++;
	}
	
	public static int contarCajas () {
		return contCajas;
	}
	
	private boolean estaLlena () {
		boolean llena;
		if (this.numCosas == this.contMax) {
			llena = true;
		}
		else {
			llena = false;
		}
		return llena;
	}
	
	private boolean estaVacia () {
		boolean vacia;
		if (this.numCosas == 0) {
			vacia = true;
		}
		else {
			vacia = false;
		}
		return vacia;
	}
	
	public void meterObjeto (int cant) {
		if ((this.numCosas + cant) <= 10) {
			this.numCosas += cant;
		}
		else {
			if (this.estaLlena() == true) {
				System.out.println("La caja esta llena");
			}
			else {
				System.out.println("No entran tantos objetos en la caja");
			}
		}
	}
	
	public void sacarObjeto (int cant) {
		if ((this.numCosas - cant) <= 10) {
			this.numCosas -= cant;
		}
		else {
			if (this.estaVacia() == true) {
				System.out.println("La caja esta vacia");
			}
			else {
				System.out.println("No hay tantos objetos en la caja");
			}
		}
	}
	
	public double calcularVolumen () {
		this.volumen = this.ancho * this.alto * this.largo;
		return volumen;
	}
	
	public void comparaCajas (Caja c1) {
		boolean mayor;
		String cadena;
		if (this.calcularVolumen() < c1.calcularVolumen()) {
			mayor = true;
		}
		else {
			mayor = false;
		}
		if (mayor == true) {
			cadena = "La nueva caja es mayor";
		}
		else {
			cadena = "La nueva caja es menor";
		}
		System.out.println(cadena);
	}
	
	public void muestraResumen () {
		System.out.println("Las caracteristicas de esta caja son:");
		System.out.println("Anchura: "+this.getAncho());
		System.out.println("Altura: "+this.getAlto());
		System.out.println("Largura: "+this.getLargo());
		System.out.println("Cosas dentro de la caja: "+this.getNumCosas());
		
	}
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
